[SUBROUTINE]
version = 1.14
icon = truetype.png
name = _("TrueType")
type = ttt
help = _("<b>Engraves TrueType</b>")
order = ena text h3 x y rot h5 font u e l h4 va ha mode th st ls dpt

[PARAM_ENA]
name = _("Active")
type = bool
value = 1
icon = enable.png

[PARAM_TEXT]
name = _("Text")
type = engrave
value =
icon = comment.png

[PARAM_H3]
name = _("Coords, rotation")
type = sub-header

[PARAM_H4]
name = _("Format")
type = sub-header

[PARAM_H5]
name = _("Font")
type = sub-header

[PARAM_X]
name = _("X")
type = float
icon = x.png
tool_tip = _("X")
value = 0.0
header = h3
metric_value = 0.0

[PARAM_Y]
name = _("Y")
type = float
icon = y.png
tool_tip = _("Y")
value = 0
header = h3
metric_value = 0.0

[PARAM_ST]
name = _("Stretch")
type = int
icon = width.png
tool_tip = _("Stretch or compress")
minimum_value = 20
value = 100
header = h4
not_allowed = 0
suffix = %

[PARAM_TH]
name = _("Text height")
type = float
icon = height.png
tool_tip = _("Y Size of text")
value = 0.5
metric_value = 12
header = h4
not_allowed = 0

[PARAM_VA]
name = _("Align vertical")
type = combo
options = _("Bottom of first line=0:Top of first line=1:Center=2:Bottom of last line=3")
value = 0
header = h4
icon = align-z.png

[PARAM_HA]
name = _("Align horizontal")
type = combo
options = _("Left=0:Center=1:Right=2")
value = 0
header = h4
icon = align-x.png

[PARAM_LS]
name = _("Line spacing")
type = float
icon = dz.png
tool_tip = _("Ratio to Text height")
value = 1.0
header = h4

[PARAM_MODE]
name = _("Mirrored")
type = bool
;tool_tip =
value = 0
header = h4

[PARAM_FONT]
name = _("Font file")
type = filename
value = /usr/share/fonts/truetype/freefont/FreeSerifBoldItalic.ttf
header = h5
patterns = *.ttf
mime_types = font
filter_name = _("Font file")
icon = truetype.png

[PARAM_U]
name = _("Unicode")
type = bool
value = 0
header = h5

[PARAM_E]
name = _("Filled")
type = bool
tool_tip = _("With horizontal lines")
value = 0
header = h5

[PARAM_L]
name = _("Filling scale")
type = int
minimum_value = 24
value = 24
header = h5

[PARAM_ROT]
name = _("Rotation")
type = float
digits = 2
icon = angle.png
tool_tip = _("Angle rotated")
value = 0
header = h3
suffix = &#176;

[PARAM_DPT]
name = _("Engraving depth")
type = float
icon = depth.png
maximum_value = 0.0
value = -0.01
metric_value = -0.2
header = h3
not_allowed = 0

[DEFINITIONS]
content = 
	<subprocess>python %SYS_DIR%/ttt -n#self_id -h#param_ha -v#param_va -H#param_th -f"#param_font" -i#param_ls -m#param_mode -e#param_e -l#param_l -t#param_st -u#param_u -T"0#param_text"</subprocess>

[CALL]
content = 
	(begin #sub_name)
	(truetype engraving author : Fernand Veilleux)
	
	o<#self_id> if [#param_ena]
		(get and save current coords system offsets)
		#<old_coord_system#ID> = [#<_coord_system> / 10]
		o<get_offsets> CALL
		#<offset_x#ID> = #<_offsets_x>
		#<offset_y#ID> = #<_offsets_y>
		#<offset_z#ID> = #<_offsets_z>
		#<offset_r#ID> = #<_offsets_r>
		
		(change coords system)
		G#<_off_rot_coord_system>
		
		(get rotated coordinates then apply to new coords)
		o<rotate_xy> CALL [#<_offsets_x> + #param_x] [#<_offsets_y> + #param_y] [#<_offsets_x>] [#<_offsets_y>] [#<_offsets_r>]
		G10 L2 P#5220 X#<_rotated_x> Y#<_rotated_y> Z#<_offsets_z> R[#<_offsets_r> + #param_rot]
		
		(Call engraving subroutine)
		o<#self_id_engrave> CALL [#<_z_clear>] [#param_dpt] [#<surface>] [#<_feed_vertical>] [#<_feed_normal>]
		
		(Restore coordinate system to origin)
		G#<old_coord_system#ID>
		G10 L2 P#5220 X#<offset_x#ID> Y#<offset_y#ID> Z#<offset_z#ID> R#<offset_r#ID>
		
	o<#self_id> endif
	(end #sub_name)

[BEFORE]
content = 


[AFTER]
content = 
